ops_set_linear_gradient (builder,
n_color_stops,
stops,
+ gsk_render_node_get_node_type (node) == GSK_REPEATING_LINEAR_GRADIENT_NODE,
builder->dx + start->x,
builder->dy + start->y,
builder->dx + end->x,
glUniform4f (program->linear_gradient.points_location,
op->start_point[0], op->start_point[1],
op->end_point[0] - op->start_point[0], op->end_point[1] - op->start_point[1]);
+ glUniform1i (program->linear_gradient.repeat_location, op->repeat);
}
static inline void
/* linear gradient */
INIT_PROGRAM_UNIFORM_LOCATION (linear_gradient, color_stops);
INIT_PROGRAM_UNIFORM_LOCATION (linear_gradient, num_color_stops);
+ INIT_PROGRAM_UNIFORM_LOCATION (linear_gradient, repeat);
INIT_PROGRAM_UNIFORM_LOCATION (linear_gradient, points);
/* radial gradient */
break;
case GSK_LINEAR_GRADIENT_NODE:
+ /* Intentional fall-through */
+ case GSK_REPEATING_LINEAR_GRADIENT_NODE:
render_linear_gradient_node (self, node, builder);
break;
render_gl_shader_node (self, node, builder);
break;
- case GSK_REPEATING_LINEAR_GRADIENT_NODE:
case GSK_REPEATING_RADIAL_GRADIENT_NODE:
case GSK_CAIRO_NODE:
default:
ops_set_linear_gradient (RenderOpBuilder *self,
guint n_color_stops,
const GskColorStop *color_stops,
+ bool repeat,
float start_x,
float start_y,
float end_x,
sizeof (GskColorStop) * real_n_color_stops);
}
+ op->repeat = repeat;
op->start_point[0] = start_x;
op->start_point[1] = start_y;
op->end_point[0] = end_x;
int num_color_stops_location;
int color_stops_location;
int points_location;
+ int repeat_location;
} linear_gradient;
struct {
int num_color_stops_location;
void ops_set_linear_gradient (RenderOpBuilder *self,
guint n_color_stops,
const GskColorStop *color_stops,
+ bool repeat,
float start_x,
float start_y,
float end_x,
#endif
uniform float u_color_stops[6 * 5];
+uniform bool u_repeat;
_NOPERSPECTIVE_ _IN_ vec4 info;
void main() {
float offset = dot(info.xy, info.zw);
+ if (u_repeat) {
+ offset = fract(offset);
+ }
+
if (offset < get_offset(0)) {
gskSetOutputColor(gsk_scaled_premultiply(get_color(0), u_alpha));
return;